package com.yanxu.threadexception;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2025/1/18-2025
 * @Description: 不能捕获异常
 */
public class CantCatchException implements Runnable{
    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 100; i++) {
            System.out.println("main "+i);
        }

        new Thread(new CantCatchException(),"thread1").start();
        new Thread(new CantCatchException(),"thread2").start();
        new Thread(new CantCatchException(),"thread3").start();
        new Thread(new CantCatchException(),"thread4").start();

        Thread.sleep(100);
        for (int i = 100; i < 200; i++) {
            System.out.println("main "+i);
        }
    }

    public void run() {
        throw new RuntimeException(Thread.currentThread().getName() + " :抛出了 runtime exception 异常了!!!");
    }
}